<script src="../include.js"></script>
<script>
    asyncTest(async done => {
        const encoder = new TextEncoder();
        const message = "Hello friends";
        const encodedMessage = encoder.encode(message);

        const keyAlgorithm = {
            name: "Ed25519",
        };
        const extractable = true;
        const usages = ["sign", "verify"];
        const key = await window.crypto.subtle.generateKey(keyAlgorithm, extractable, usages);

        const signatureAlgorithm = {
            name: "Ed25519",
        };
        const signature = await window.crypto.subtle.sign(
            signatureAlgorithm,
            key.privateKey,
            encodedMessage
        );

        println(`Signed OK`);

        done();
    });
</script>
